#ifndef SLAVE_H
#define SLAVE_H

#include <QObject>
#include <QTimer>

#include <QtSerialPort/QSerialPort>


class Slave  : public QObject
{
    Q_OBJECT

public:
    Slave();

private slots:
    void startSlave(QString port_name);
    void readRequest();
    void processTimeout();

private:
    void processError(const QString &s);

    int ms_frame;

    int m_transactionCount = 0;
    QSerialPort m_serial;
    QByteArray m_request;
    QTimer m_timer;
};

#endif // SLAVE_H
